package com.hbnu.system.service.impl;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hbnu.system.config.BaseException;
import com.hbnu.system.mapper.DeveloperParameterMapper;
import com.hbnu.system.model.entity.DeveloperParameter;
import com.hbnu.system.service.DeveloperParameterService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@Service
public class DeveloperParameterServiceImpl extends ServiceImpl<DeveloperParameterMapper, DeveloperParameter> implements DeveloperParameterService {
    /**
     * 统计分类查询
     */
    @Override
    public List<String> FXSelect() {
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"FX"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
    /**
     * 所属机构查询
     */
    public List<String> ZZSelect() {
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
            .eq(DeveloperParameter::getCodeclass,"ZZ"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;}
    /**
     * 署名单位查询
     */
    public  List<String> AVSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
            .eq(DeveloperParameter::getCodeclass,"AV"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;}
    /**
     * 刊物分类查询
     */
    public List<String> ADSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"AD"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
    /**
     * 论文分类查询
     */
    public List<String> YUSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"YU"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
    /**
     * 论文来源查询
     */
    public List<String> AZSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"AZ"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
    /**
     * 研究类别查询
     */
    public List<String> CZSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"CZ"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
    /**
     * 一级学科查询
     */
    public List<String> BZSelect(){
        List<DeveloperParameter> dp = baseMapper.selectList(Wrappers.lambdaQuery(DeveloperParameter.class)
                .eq(DeveloperParameter::getCodeclass,"BZ"));
        if(Objects.isNull(dp)){
            throw new BaseException("数据出错");
        }
        List<String> strs = new ArrayList<>();
        for(DeveloperParameter dp1:dp){
            strs.add(dp1.getCodeabout());
        }
        return strs;
    }
}

